package demoMod.stsconsole.rewards;

import demoMod.stsconsole.dungeons.AbstractDungeon;
import demoMod.stsconsole.helpers.LocalizedStrings;
import demoMod.stsconsole.helpers.PotionLibrary;
import demoMod.stsconsole.potions.AbstractPotion;

import java.util.List;

public class PotionReward extends AbstractReward {
    private final AbstractPotion potion;

    public PotionReward() {
        this.potion = PotionLibrary.getPotion(AbstractDungeon.potionRng, AbstractDungeon.currDungeon.currMapNode.room.getRandomPotionRarity(AbstractDungeon.potionRng));
    }

    @Override
    public boolean claimReward() {
        List<String> strings = LocalizedStrings.getRewardStrings("AbstractReward");
        if (AbstractDungeon.player.getPotions().size() >= AbstractDungeon.player.maxPotionSlot) {
            System.out.println(strings.get(7));
            return false;
        }
        System.out.println(strings.get(6) + this.potion.name);
        AbstractDungeon.player.obtainPotion(this.potion);
        return true;
    }

    @Override
    public void preview() {
        List<String> strings = LocalizedStrings.getRewardStrings("AbstractReward");
        System.out.println(strings.get(2) + "\t" + this.potion.name + "\t" + this.potion.getUpdatedDescription());
    }

    @Override
    public void skipped() {
        this.potion.onRemove();
    }
}
